/*  
* Copyright (c) 2010, James Daniello
* This project is licensed under the 'New BSD' license.
* The full text of the license can be found in the root
* directory under the filename "LICENSE"
*/
package src.gui;

import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.Container;
import java.awt.Color;
import javax.swing.JButton;
import javax.swing.BorderFactory;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.BorderLayout;

public class PICAIUClientGUINoServer implements PICAIUGUI{

  //The various gui components.
  private Container frame;       //<-- the main panel container
  private JPanel content;
  private PICAIUClientGUI parent;
  
  
  

  
  /**
  * Creates the gui component for when the server can not be contacted
  */
  public PICAIUClientGUINoServer(Container frameIn, PICAIUClientGUI parentIn){
    frame = frameIn;
    parent = parentIn;
    initGUI();
  }
  
  
  /**
  * creates the gui components
  */
  public void initGUI(){
    content = new JPanel();
    
    JPanel padding1 = new JPanel();
    padding1.setSize(750,150);
    padding1.setPreferredSize(new java.awt.Dimension(750,150));
    padding1.setMaximumSize(new java.awt.Dimension(750,150));
    padding1.setMinimumSize(new java.awt.Dimension(750,150));
    content.add(padding1);
    
    content.add(new JLabel("                           The server could not be contacted. Please try again."));
    content.add(new JLabel("                          "));
    content.add(new JLabel("                                                           If this persists, please contact the network Administrator"));
    content.add(new JLabel("                                                           "));
    content.add(new JLabel("                                                                                                                        "));
    content.add(new JLabel("                                                                                                                        "));
    JButton retry = new JButton("Retry");
    retry.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent evt){
        parent  .setGUI("login");
      }
    });
    content.add(retry);
  }
  
  /**
  * This method switches the clients main container to this GUI's graphics.
  */
  @Override
  public void setAsGUI(){
  
    frame.removeAll();
    frame.add(content,BorderLayout.CENTER);
    frame.validate();
  
  }

  /**
  * This sets the colors of all the components affected by the color scheme to that of the current 
  * colors for the GUI
  */
  @Override
  public void setColors(PICAIUGUIScheme colorScheme){
    
    Color colorBG01=colorScheme.getBG01();
    Color colorBG02=colorScheme.getBG02();
    Color colorFG01=colorScheme.getFG01();
    Color colorBorder01=colorScheme.getBorder01();
  
  }

}